<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('员工薪资v1.0列表')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-10 search-collapse">
                <form id="formId">
                    <dvi class="select-list">
                        <ul>
                            <li>
                                <label>工资年月：</label>
                                <input name="salaryYearMonth" placeholder="请选择年月" class="form-control" type="text">
                            </li>
                            <li>
                                <label>入职时间：</label>
                                <input name="hireDate" placeholder="请选择年月日" class="form-control" type="text">
                            </li>
                            <li>
                                <label>离职时间：</label>
                                <input name="leaveDate" placeholder="请选择年月日" class="form-control" type="text">
                            </li>
                        </ul>
                    </dvi>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>员工姓名：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>部门：</label>
                                <input type="text" name="deptName"/>
                            </li>
                            <li>
                                <label>小组名称：</label>
                                <input type="text" name="groupName"/>
                            </li>
                            <li>
                                <label>岗位名称：</label>
                                <input type="text" name="postName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:v1:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:v1:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:v1:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:v1:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:v1:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: datetimepicker-js" />
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <div class="mt10 pt5">
                     &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
                 </div>
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
    </script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:v1:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:v1:remove')}]];
        var prefix = ctx + "system/v1";
        //工资年月
        $("input[name='salaryYearMonth']").datetimepicker({
            format: "yyyy-mm",
            todayBtn: "linked",
            startView: 'year',
            minView: 'year',
            maxView: 'year',
            language: "zh-cn",
            orientation: "bottom auto",
            autoclose: true,
            todayHighlight: true
        });

        //入职
        $("input[name='hireDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        //离职
        $("input[name='leaveDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                //导入请求地址
                importUrl: prefix + "/import",
                //模板生成
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "员工薪资v1.0",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'salaryYearMonth',
                    title: '工资发放年月'
                },
                {
                    field: 'userName',
                    title: '员工姓名'
                },
                {
                    field: 'hireDate',
                    title: '入职时间'
                },
                {
                    field: 'leaveDate',
                    title: '离职时间'
                },
                {
                    field: 'deptName',
                    title: '部门'
                },
                {
                    field: 'groupName',
                    title: '小组名称'
                },
                {
                    field: 'postName',
                    title: '岗位名称'
                },
                {
                    field: 'baseSalary',
                    title: '实际基本工资'
                },
                {
                    field: 'otherSalary',
                    title: '其他薪资合计'
                },
                {
                    field: 'preSalary',
                    title: '税前薪资'
                },
                {
                    field: 'realitySalary',
                    title: '实发工资'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>